﻿<%@ Page Language="C#" MasterPageFile="~/EasyUI.master" AutoEventWireup="true"
    CodeBehind="Add.aspx.cs" Inherits="jnxc.Web.preventionskill.Add" Title="增加页" %>

<%@ Register assembly="CKEditor.NET" namespace="CKEditor.NET" tagprefix="CKEditor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">    
     <script type="text/javascript">
         $(function () {
             InitTree();
             var wid = $(parent.document).find("#mainPanle").width();
             $("#ckedit").width(wid - 350);
         });
         function InitTree() {
             $('#tt').tree({
                 url: '../harmfulinfo/GetHarm.ashx', //请求数据的页面               
                 width: '100%', //宽度
                 //height: $(parent.document).find("#mainPanle").height() - 35 > 0 ? $(parent.document).find("#mainPanle").height() - 35 : 500, //高度
                 lines: true,
                 method: 'post',
                 queryParams: { "action": "querymy" },
                 checkbox: true,
                 onlyLeafCheck: true,
                 onCheck: function (node, checked) {
                     if (checked) {
                         var cknodes = $(this).tree("getChecked");
                         if (cknodes.length > 1) {
                             for (var i = 0 ; i < cknodes.length ; i++) {
                                 $(this).tree("uncheck", cknodes[i].target);
                             }
                             //再选中改节点
                             $(this).tree("check", node.target);
                         }
                         $('#<%# hfhid.ClientID%>').val(node.id);  // 在用户点击的时候提示
                     }
                 },                 
                 onLoadSuccess: function (node, data) {
                     //$('.tree-checkbox').unbind('click');
                     var hid = $('#<%# hfhid.ClientID%>').val();
                     if (hid != "") {
                         var node = $('#tt').tree("find", hid);
                         $('#tt').tree("check", node.target);

                     }

                 }

             });
         }
         function testchk()
         {
             var hid = $('#<%# hfhid.ClientID%>').val();
             if (hid != "") {
                 return true;

             }
             else {
                 $.messager.alert("提示", "请选择一个有害生物！", "info");
                 return false;
             }

         }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div style="width:300px;float:left;">
    <div id="p" class="easyui-panel" title="有害生物信息" data-options="iconCls:'icon-save',tools:'#tab_toolbar'">   
    <ul id="tt"></ul> 
</div> 

</div>
 
    <div id="ckedit" style="float:left;padding-left:15px;">
        <form id="fm" method="post" runat="server">

            <div >
                <label>基本信息：</label>
                <div align="left">
                <CKEditor:CKEditorControl ID="ckcontent" runat="server"></CKEditor:CKEditorControl>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                    ControlToValidate="ckcontent" ErrorMessage="RequiredFieldValidator" 
                    ForeColor="Red">内容不能为空</asp:RequiredFieldValidator>
                </div>
            <input name="Test" id="test" type="hidden" />
                <input name="uid" id="uid" type="hidden" />
                <input id="key" name="key" onkeydown="if(event.keyCode==13)reloadgrid()" type="hidden" />
                <input name="level" id="level" type="hidden" />
            </div>
            <div>
         <asp:Button ID="btnSave" runat="server" Text="保存"
                    OnClick="btnSave_Click" class="easyui-linkbutton" data-options="iconCls:'icon-save'" OnClientClick="return testchk()"></asp:Button>
                <asp:Button ID="btnCancle" runat="server" Text="取消" data-options="iconCls:'icon-cancle'"
                    OnClick="btnCancle_Click" class="easyui-linkbutton"></asp:Button>
                <asp:HiddenField ID="hfhid" runat="server" />
                <asp:HiddenField ID="hfpsid" runat="server" />
                </div>
        </form>
    </div>
   
</asp:Content>


